<?php

namespace app\shop\controller;

use app\shop\model\ShopModel;
use think\admin\Controller;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;

class Shop extends Controller
{
    /**
     * 当前操作数据库
     * @var string
     */
    private string $table = 'Shop';

    /**
     * 商户管理
     * @auth true
     * @menu true
     * @throws DataNotFoundException
     * @throws DbException
     * @throws ModelNotFoundException
     */
    public function index()
    {
        $this->title = '商户管理';

        $this->_query(ShopModel::class)->like('phone,username')->equal('type')->order('id', 'DESC')->page(true, true);
    }

    /**
     * 数据列表处理
     * @param array $data
     */
    protected function _page_filter(array &$data)
    {

    }

    /**
     * @return void
     */
    public function add()
    {
        ShopModel::mForm('form');
    }

    /**
     * @return void
     */
    public function edit()
    {
        ShopModel::mForm('form');
    }

    /**
     * 删除系统用户
     * @auth true
     */
    public function remove()
    {
        ShopModel::mDelete();
    }
}